﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                    xmlns:controlsPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls"
                    xmlns:c4f="clr-namespace:Coding4Fun.Phone.Controls;assembly=Coding4Fun.Phone.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Brushes.xaml" />
        <ResourceDictionary Source="Fonts.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="PanoramaStyle"
           TargetType="controls:Panorama">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <controlsPrimitives:PanoramaPanel x:Name="panel" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground"
                Value="{StaticResource PhoneForegroundBrush}" />
        <Setter Property="Background"
                Value="{StaticResource PhoneBackgroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:Panorama">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <controlsPrimitives:PanningBackgroundLayer x:Name="BackgroundLayer"
                                                                   HorizontalAlignment="Left"
                                                                   Grid.RowSpan="2">
                            <Border x:Name="background"
                                    Background="{TemplateBinding Background}"
                                    CacheMode="BitmapCache" />
                        </controlsPrimitives:PanningBackgroundLayer>
                        <controlsPrimitives:PanningTitleLayer x:Name="TitleLayer"
                                                              CacheMode="BitmapCache"
                                                              ContentTemplate="{TemplateBinding TitleTemplate}"
                                                              Content="{TemplateBinding Title}"
                                                              FontSize="187"
                                                              FontFamily="{StaticResource PhoneFontFamilyLight}"
                                                              HorizontalAlignment="Stretch"
                                                              Grid.Row="0"
                                                              HorizontalContentAlignment="Stretch"
                                                              VerticalContentAlignment="Stretch"
                                                              MinHeight="125" />
                        <controlsPrimitives:PanningLayer x:Name="ItemsLayer"
                                                         HorizontalAlignment="Left"
                                                         Grid.Row="1"
                                                         Background="{TemplateBinding Background}">
                            <ItemsPresenter x:Name="items" />
                        </controlsPrimitives:PanningLayer>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="PanoramaItemStyle"
           TargetType="controls:PanoramaItem">
        <Setter Property="CacheMode"
                Value="BitmapCache" />
        <Setter Property="HorizontalContentAlignment"
                Value="Stretch" />
        <Setter Property="VerticalContentAlignment"
                Value="Stretch" />
        <Setter Property="Padding" Value="12,0,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:PanoramaItem">
                    <Grid Background="{TemplateBinding Background}"
                          Margin="12,0,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="124" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <ContentControl x:Name="header"
                                        ContentTemplate="{TemplateBinding HeaderTemplate}"
                                        Content="{TemplateBinding Header}"
                                        FontSize="{StaticResource PhoneFontSizeExtraExtraLarge}"
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Top"
                                        Margin="10,-2,0,18"
                                        Foreground="{StaticResource AccentBrushLight}">
                            <ContentControl.RenderTransform>
                                <TranslateTransform x:Name="headerTransform" />
                            </ContentControl.RenderTransform>
                        </ContentControl>
                        <ContentPresenter Content="{TemplateBinding Content}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}"
                                          Grid.Row="1"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="PivotItemStyle"
           TargetType="controls:PivotItem">
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="Margin"
                Value="12,8,12,0" />
        <Setter Property="Padding"
                Value="0" />
        <Setter Property="HorizontalContentAlignment"
                Value="Stretch" />
        <Setter Property="VerticalContentAlignment"
                Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:PivotItem">
                    <Grid Background="{TemplateBinding Background}"
                          CacheMode="BitmapCache"
                          HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                          VerticalAlignment="{TemplateBinding VerticalAlignment}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="Pivot">
                                <VisualState x:Name="Right" />
                                <VisualState x:Name="Left" />
                                <VisualState x:Name="Center" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Content="{TemplateBinding Content}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="c4f:ToastPrompt"
           x:Key="ToastPromptStyle">
        <Setter Property="FontFamily"
                Value="{StaticResource PhoneFontFamilyNormal}" />
        <Setter Property="FontSize"
                Value="{StaticResource PhoneFontSizeSmall}" />
        <Setter Property="Foreground"
                Value="White" />
        <Setter Property="Background"
                Value="{StaticResource PhoneAccentBrush}" />
        <Setter Property="VerticalAlignment"
                Value="Top" />
        <Setter Property="Overlay"
                Value="{StaticResource TransparentBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c4f:ToastPrompt">
                    <Grid VerticalAlignment="{TemplateBinding VerticalAlignment}"
                          Background="{TemplateBinding Background}">
                        <StackPanel VerticalAlignment="Bottom"
                                    Margin="24,32,16,5"
                                    Orientation="{TemplateBinding TextOrientation}">
                            <StackPanel Margin="0,0,16,0"
                                        VerticalAlignment="Bottom"
                                        Orientation="Horizontal">
                                <Image Width="{Binding ElementName=ToastName, Path=ActualHeight}"
                                       Height="{Binding ElementName=ToastName, Path=ActualHeight}"
                                       Margin="0,0,16,0"
                                       Visibility="Collapsed"
                                       Name="ToastImage"
                                       VerticalAlignment="Bottom"
                                       Source="{TemplateBinding ImageSource}" />
                                <TextBlock Name="ToastName"
                                           Text="{TemplateBinding Title}"
                                           FontWeight="Bold"
                                           VerticalAlignment="Bottom"
                                           Margin="0"
                                           Padding="0" />
                            </StackPanel>
                            <TextBlock Text="{TemplateBinding Message}"
                                       TextWrapping="Wrap"
                                       Margin="0"
                                       Padding="0" />
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>